﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.IO;
using attendance.L3Bussobject;
using attendance.L2Busslogic;

namespace attendance.L4View.student
{
    public partial class student_qiandao : System.Web.UI.Page
    {
        public static string ID;
        public static string q_name;
        public static string q_numb;
        public static string q_date;
        public static string q_ip;
        public static string q_photo;
        public static string photo;
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            qiandaoOB mydd = new qiandaoOB();
            mydd = qiandaoBL.Getwordsingle(Session["login"].ToString());
            if (mydd.q_photo != "")
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('已经签到，不能重复签到 ');</script>");
                if (qiandaoBL.deletephoto(mydd.q_name,""))
                {
                        return;
                }
            }
            else
            {
                ID = mydd.ID;
                q_name = mydd.q_name;
                q_numb = mydd.q_numb;
                q_date = mydd.q_date;
                q_ip = mydd.q_ip;
                q_photo = mydd.q_photo;
                photo = mydd.photo;
                qiandaoOB myword = new qiandaoOB();
                myword.ID = ID;
                myword.q_name = q_name;
                myword.q_numb = q_numb;
                myword.q_date = DateTime.Now.ToString();
                myword.q_ip = q_ip;
                myword.q_photo = Session["xxx"].ToString();
                myword.photo = photo;
                if (qiandaoBL.Savemark(myword))
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('签到成功 ');</script>");
                    Response.Redirect("~/L4View/student/student_qiandao_info.aspx");
                    return;
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "message", "<script language='javascript' defer>alert('签到不成功 ');</script>");
                    return;
                }
            }
        }
    }
}